package javabase.collection.list.performance;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

public class LinkedListCapability {

	public static void main(String[] args) {
		String [] strArray = new String[200000];
		Arrays.fill(strArray, "test");
		
		List<String> list = new LinkedList<String>(Arrays.asList(strArray));
		long startTime = System.currentTimeMillis();
		for (int i = 0; i < 100000; i ++) {
			list.add(100000, "world");
		}
		long endTime = System.currentTimeMillis();
		// 10W:10858  2W:437
		System.out.println("在一个已有20W个元素的LinkedList前面插入10W需耗时：" + (endTime - startTime));
	}

}
